home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / a_utils / ffccflow / ffccflow.lha / ffccc+flow / flow / unixflow.for < prev    next >
Text File  |  1992-07-31  |  6KB  |  183 lines

  1.       PROGRAM FLOW
  2. C-------------------------------------------------------------------------
  3. C Flow UNIX interface routine.
  4. C Sets up various required input files and parameters for Flow
  5. C Julian Bunn 1992
  6. C-------------------------------------------------------------------------
  7.       INCLUDE 'lunits.h'
  8.       INCLUDE 'params.h'
  9.       INCLUDE 'jobcom.h'
  10.       INCLUDE 'ignore.h'
  11.       INCLUDE 'trecom.h'
  12.       PARAMETER (MLLEN=255,maxarg=100)
  13.       character*(mxlin) argval
  14.       character*1 key,char
  15.       CHARACTER*(MLLEN)  cfile,clong
  16.       LOGICAL LOG,fexist,fold,fqold,tidy
  17. c
  18. c get all arguments
  19. c
  20.       numargs = iargc()
  21.       if(numargs.gt.maxarg) then
  22.          write(6,'(A)') ' Flow --> Too many arguments '
  23.          goto 900
  24.       endif
  25. c
  26. c get input file from Flow
  27. c
  28.       call getarg(numargs,cfile)       
  29.       lfile = index(cfile,' ')-1
  30.       write(6,'(A)') ' Flow --> Input Floppy file '//cfile(:lfile)
  31.       inquire(file=cfile(:lfile),exist=fexist)
  32.       if(.not.fexist) then
  33.         write(6,'(A)') ' Flow --> Input file not found !'
  34.         goto 900
  35.       endif
  36.       lintre = 50
  37.       open(lintre,file=cfile(:lfile),status='old',
  38.      &     form='unformatted',err=900)
  39. c
  40.       log = .false.      
  41.       lext = .true.
  42.       lqery = .false.                    
  43.       lchrt = .false.
  44.       lsubs = .false.
  45.       lcomm = .false.
  46.       ltree = .false.
  47.       loutch = 96
  48.       ctree = '$$$$'
  49. c
  50. c Find if -l was given
  51. c
  52.       do 400 iarg = 1,numargs-1
  53.          call getarg(iarg,argval)
  54.          larg = index(argval,' ')-1 
  55.          key = argval(2:2)
  56.          if(key.eq.'l') then
  57.            log = .true.
  58.          endif
  59.   400 continue
  60. c
  61. c loop over all qualifiers
  62. c
  63.       icheck = 0
  64.       do 500 iarg = 1,numargs-1
  65.          call getarg(iarg,argval)
  66.          larg = index(argval,' ')-1 
  67.          key = argval(2:2)
  68.          if(key.eq.'l') then
  69.            log = .true.
  70.          else if(key.eq.'q') then
  71.            lqery = .true.
  72.            if(log) write(6,'(A)') ' Flow --> Queries on the tree'
  73.          else if(key.eq.'E') then
  74.            lext = .false.
  75.            if(log) write(6,'(A)') ' Flow --> Exclude externals'
  76.          else if(key.eq.'c') then
  77.            if(argval(3:3).eq.' ') then
  78.               ccomm = 'procom.dat'
  79.               lcmm = 10
  80.            else
  81.               ccomm = argval(3:)
  82.               lcmm = index(ccomm,' ')-1 
  83.            endif
  84.            inquire(file=ccomm(:lcmm),exist=fexist)
  85.            if(fexist) then
  86.               open(loutco,file=ccomm(:lcmm),status='old')
  87.               close(loutco,status='delete')
  88.            endif
  89.            if(log) write(6,'(A)') ' Flow --> COMMON Table: '//
  90.      &             ccomm(:lcmm) 
  91.            lcomm = .true.
  92.            loutco = 60
  93.            open(loutco,file=ccomm(:lcmm),status='new',err=900)
  94.          else if(key.eq.'s') then
  95.            if(argval(3:3).eq.' ') then
  96.               chart = 'protre.dat'
  97.               lchart = 10
  98.            else
  99.               chart = argval(3:)
  100.               lchart = index(chart,' ')-1 
  101.            endif
  102.            inquire(file=chart(:lchart),exist=fexist)
  103.            if(fexist) then
  104.               open(loutre,file=chart(:lchart),status='old')
  105.               close(loutre,status='delete')
  106.            endif
  107.            if(log) write(6,'(A)') ' Flow --> Text Structure Chart: '//
  108.      &             chart(:lchart) 
  109.            ltree = .true.
  110.            loutre = 61
  111.            open(loutre,file=chart(:lchart),status='new',err=900)
  112.          else if(key.eq.'i') then
  113.            clong = argval(3:)
  114.            llong = lenocc(clong)
  115.            if(llong.le.0) then
  116.               write(6,'(A)') ' Flow --> No Ignore names given'
  117.               goto 900
  118.            endif
  119.    60      icomma = index(clong,',')
  120.            if(icomma.ne.0) then
  121.               nigno = nigno + 1
  122.               cigno(nigno) = clong(:icomma-1)
  123.               ligno(nigno) = icomma-1
  124.               clong = clong(icomma+1:)
  125.               call caschg(cigno(nigno),cigno(nigno))
  126.               goto 60
  127.            endif
  128.            nigno = nigno + 1
  129.            ligno(nigno) = index(clong,' ')-1
  130.            cigno(nigno) = clong(:ligno(nigno))
  131.            call caschg(cigno(nigno),cigno(nigno))
  132.            if(log) write(6,'(A)') ' Flow --> Ignore modules:'
  133.            if(log) write(6,'(10x,6a8)') (cigno(i),i=1,nigno)
  134.          else if(key.eq.'g') then
  135.            if(argval(3:3).eq.' ') then
  136.               cgraph = 'flow.ps'
  137.               lgraph = 7
  138.            else
  139.               cgraph = argval(3:)
  140.               lgraph = index(cgraph,' ')-1 
  141.            endif
  142.            inquire(file=cgraph(:lgraph),exist=fexist)
  143.            if(fexist) then
  144.               open(loutch,file=cgraph(:lgraph),status='old')
  145.               close(loutch,status='delete')
  146.            endif
  147.            if(log) write(6,'(A)') ' Flow --> Graphical Chart: '//
  148.      &             cgraph(:lgraph) 
  149.            lchrt = .true.
  150.            loutre = 96
  151.            open(loutre,file=chart(:lchart),status='new',err=900)
  152.          else if(key.eq.'n') then
  153.            ctree = argval(3:)
  154.            ltre = lenocc(ctree)
  155.            if(ltre.le.0) then
  156.              if(log) write(6,'(A)') ' Flow --> No node name for -n'
  157.              goto 900
  158.            endif
  159.            call caschg(ctree,ctree)
  160.            if(log) write(6,'(A)') ' Flow --> Start from node: '//
  161.      &             ctree(:ltre)
  162.          else 
  163.            write(6,'(A)') ' Flow --> Unrecognized qualifier '//key
  164.            goto 900
  165.          endif
  166.   500 continue
  167. c
  168. c Call Flow
  169. c
  170.       call prodes
  171. c
  172.       if(lcomm) close(loutco)
  173.       if(ltree) close(loutre)
  174.       if(lchrt) close(loutch)
  175.       close(lintre)
  176.       goto 2000
  177. c
  178.   900 write(6,'(A)') ' Flow aborted'     
  179.       stop 1
  180.  2000 CONTINUE
  181.       END
  182.